package com.lin.demo.dao.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lin.demo.dao.ProductDao;
import com.lin.demo.entity.Product;
import com.lin.demo.mapper.ProductMapper;
import com.lin.demo.utils.QueryHelp;

import java.util.List;

/**
 * @Author zimingl
 * @Date 2023/3/16 23:36
 * @Description: TODO
 */
public class ProductDaoImpl extends ServiceImpl<ProductMapper, Product> implements ProductDao {
    @Override
    public <Q> Product getOne(Q query) {
        return baseMapper.selectOne(QueryHelp.getQueryWrapper(query));
    }

    @Override
    public <Q> List<Product> getList(Q query) {
        return baseMapper.selectList(QueryHelp.getQueryWrapper(query));
    }

    @Override
    public <Q> Page<Product> getPage(Page<Product> page, Q query) {
        return baseMapper.selectPage(page, QueryHelp.getQueryWrapper(query));
    }
}
